﻿using Inaction.Criteria;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace Inaction.Linq.Clause
{
    class InClause : WhereClause
    {
        public InClause(LinqRoot root, BinaryExpression e)
            : base(root, e)
        {
            Type = e.Type;
            Operate = CriteriaOperate.In;
            Left = LinqParse.Parse(e.Left, root);
            Right = LinqParse.Parse(e.Right, root);
        }

        public override string GetClauseSql()
        {
            string s = Rule.EnumDescription.GetDescription(Operate);
            return Left.GetClauseSql() + s + Right.GetClauseSql();
        }
    }
}
